{% extends 'student/base.html' %}
{% load student_customer_tags %}
{% load student_customer_filters %}

{% load static %}
{% block link %}<link rel="stylesheet" href={% static 'student/css/detail.css' %}>{% endblock %}

{% block title %}学生信息编辑{% endblock %}
{% block section %}{{ section }}{% endblock %}
{% block index %}
    <form class="form-horizontal" method="post">
    {% csrf_token %}
    {% for field in form %}
        <div class="form-group" {% if field.errors %}style="color: red"{% endif %} >
            <label for="field.id_for_label" class="col-sm-2 control-label">{{ field.label }}</label>
            <div class="col-sm-3">
                {% if field.label == '性别' %}
                    {{ field }}
                {% else %}
                    {{ field|add_class:"form-control" }}
                {% endif %}</div>
                {% for error in field.errors %}
                    <label for="field.id_for_label" class="col-sm-2 control-label">{{ error }}</label>
                {% endfor %}

        </div>
    {% endfor %}{% for field in detail_form %}
        <div class="form-group" {% if field.errors %}style="color: red"{% endif %} >
            <label for="field.id_for_label" class="col-sm-2 control-label">{{ field.label }}</label>
            <div class="col-sm-3">
                    {{ field|add_class:"form-control" }}
             </div>
                {% for error in field.errors %}
                    <label for="field.id_for_label" class="col-sm-3 control-label">{{ error }}</label>
                {% endfor %}
        </div>
    {% endfor %}
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            {% if section != '学生个人详情' %}
            <button type="submit" class="btn btn-default">保存</button>
            <a type="reset" class="btn btn-primary" href={% url 'student:student_edit' 0 %}>重置</a>
           {% endif %}
            <a type="button" class="btn btn-danger" href={% url 'student:index' %}>返回</a>
        </div>
    </div>
    </form>
{% endblock %}